#include <stdio.h>
#include <flgrCoreData.h>
#include <flgrCoreDataIO.h>
#include <flgrCoreCopy.h>
#include <flgrMatrixTransform.h>
#include "../macro.h"





/////////////////////////////////////////////////////////////////////////
// Test Macro for all flgr2d_convolution types
/////////////////////////////////////////////////////////////////////////
#define tstMatrixMult(dtype)						\
									\
  dtype raw_a[]={1,2,1};						\
  dtype raw_b[]={1,2,1};						\
									\
  dtype rawref[]={1,2,1,						\
		  2,4,2,						\
		  1,2,1};						\
									\
									\
									\
  FLGR_Data2D *img_a,*img_b, *imgref, *img;				\
  FLGR_Ret ret;								\
									\
  img_a  = flgr2d_create_pixmap(3,1,1,flgr_get_type_from_string(#dtype)); \
  img_b  = flgr2d_create_pixmap(1,3,1,flgr_get_type_from_string(#dtype)); \
  imgref = flgr2d_create_pixmap(3,3,1,flgr_get_type_from_string(#dtype)); \
  img    = flgr2d_create_pixmap(3,3,1,flgr_get_type_from_string(#dtype)); \
									\
  flgr2d_import_raw_ptr(img_a,raw_a);					\
  flgr2d_import_raw_ptr(img_b,raw_b);					\
  flgr2d_import_raw_ptr(imgref,rawref);					\
  									\
  ret=flgr2d_matrix_mult(img,img_a,img_b);				\
									\
  check_and_display_data2d(imgref,img,ret);				\
									\
  flgr2d_destroy(img_a);						\
  flgr2d_destroy(img_b);						\
  flgr2d_destroy(imgref);						\
  flgr2d_destroy(img);							\
									\
  return 1

int testMatrixMult_fgUINT8(void) {
  tstMatrixMult(fgUINT8);
}
int testMatrixMult_fgUINT16(void) {
  tstMatrixMult(fgUINT16);
}
int testMatrixMult_fgUINT32(void) {
  tstMatrixMult(fgUINT32);
}
int testMatrixMult_fgINT8(void) {
  tstMatrixMult(fgINT8);
}
int testMatrixMult_fgINT16(void) {
  tstMatrixMult(fgINT16);
}
int testMatrixMult_fgINT32(void) {
  tstMatrixMult(fgINT32);
}
int testMatrixMult_fgFLOAT32(void) {
  tstMatrixMult(fgFLOAT32);
}
int testMatrixMult_fgFLOAT64(void) {
  tstMatrixMult(fgFLOAT64);
}
